define(function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function() {
                return {
                    list: {},
                    store:{},
                    loading:0,
                    name:'addCard',
                    url :'https://www.bestsmartbee.com/admin/addon-wx-config/auth'
                  
                    
                };
            },
            el: '#pageChooseAppid',
            created: function() {
                this.fetchData();
            },
            mounted: function() {
                if (this.mounted == 1) {
                    return;
                }
                this.mounted = 1;
                app.copy("#shareClipboard",function(res){
                   if(res=="success"){
                     app.alert("链接复制成功,请在微信中打开链接授权公众号");
                   }else{
                     this.addWxApp();
                   }
                });
            },
            methods: {
                fetchData: function() {
                    var _this = this;

                    this.get_public_platform();
                    
                     this.name =this.$route.params.type;
                },
                 addWxApp:function(){
                   app.confirm({
                     text:'请在微信访问：https://www.bestsmartbee.com/admin/addon-wx-config/auth' 
                  });
                },
                get_public_platform:function(){
                    var that = this;
                    if( that.loading == 1){
                        return ;
                     }
                     that.loading = 1;
                    
                    var user_info =  app.getUserInfo();
                    app.get("api/wechat_tool/get_public_platform", {store_id:user_info.store_id},function(res){
                        that.list = res.data;
                    });
                  
                }
            }

        }).$mount('#app');
    };
    module.exports = controller;
});
